package com.grow.greenhouse.common;

import com.grow.greenhouse.utils.MqttUtil;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@Component
public class MqttSubscriber {

    @Resource
    private MqttUtil mqttUtil;

    @PostConstruct
    public void init(){
//        //订阅发布主题
//        String topic="$sys/098k43SLt4/d1/thing/property/post";
//        mqttUtil.subscribe(topic,0);
        String topic="$sys/098k43SLt4/d1/thing/property/post/reply";
        mqttUtil.subscribe(topic,0);
////        //订阅接收主题
//        String topic = "$sys/5SOPd6Pc39/zhu_kong_ban/thing/property/post/reply";
//        mqttUtil.subscribe(topic,0);
    }
}
